package com.ktgj.flight.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.flight.domain.FlightOrderChangeH;
import com.ktgj.flight.service.IFlightOrderChangeHService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 机票预订_机票退改签废订单历史Controller
 * 
 * @author ruoyi
 * @date 2021-10-26
 */
@ControllerAdvice
@RestController
@RequestMapping("/h")
public class FlightOrderChangeHController extends BaseController
{
    @Autowired
    private IFlightOrderChangeHService flightOrderChangeHService;

    /**
     * 查询机票预订_机票退改签废订单历史列表
     */
    @PreAuthorize(hasPermi = "flight:h:list")
    @GetMapping("/list")
    public TableDataInfo list(FlightOrderChangeH flightOrderChangeH)
    {
        startPage();
        List<FlightOrderChangeH> list = flightOrderChangeHService.selectFlightOrderChangeHList(flightOrderChangeH);
        return getDataTable(list);
    }

    /**
     * 导出机票预订_机票退改签废订单历史列表
     */
    @PreAuthorize(hasPermi = "flight:h:export")
    @Log(title = "机票预订_机票退改签废订单历史", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FlightOrderChangeH flightOrderChangeH) throws IOException
    {
        List<FlightOrderChangeH> list = flightOrderChangeHService.selectFlightOrderChangeHList(flightOrderChangeH);
        ExcelUtil<FlightOrderChangeH> util = new ExcelUtil<FlightOrderChangeH>(FlightOrderChangeH.class);
        util.exportExcel(response, list, "机票预订_机票退改签废订单历史数据");
    }

    /**
     * 获取机票预订_机票退改签废订单历史详细信息
     */
    @PreAuthorize(hasPermi = "flight:h:query")
    @GetMapping(value = "/{changeOrderIdH}")
    public AjaxResult getInfo(@PathVariable("changeOrderIdH") Long changeOrderIdH)
    {
        return AjaxResult.success(flightOrderChangeHService.selectFlightOrderChangeHById(changeOrderIdH));
    }

    /**
     * 新增机票预订_机票退改签废订单历史
     */
    @PreAuthorize(hasPermi = "flight:h:add")
    @Log(title = "机票预订_机票退改签废订单历史", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FlightOrderChangeH flightOrderChangeH)
    {
        return toAjax(flightOrderChangeHService.insertFlightOrderChangeH(flightOrderChangeH));
    }

    /**
     * 修改机票预订_机票退改签废订单历史
     */
    @PreAuthorize(hasPermi = "flight:h:edit")
    @Log(title = "机票预订_机票退改签废订单历史", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FlightOrderChangeH flightOrderChangeH)
    {
        return toAjax(flightOrderChangeHService.updateFlightOrderChangeH(flightOrderChangeH));
    }

    /**
     * 删除机票预订_机票退改签废订单历史
     */
    @PreAuthorize(hasPermi = "flight:h:remove")
    @Log(title = "机票预订_机票退改签废订单历史", businessType = BusinessType.DELETE)
	@DeleteMapping("/{changeOrderIdHs}")
    public AjaxResult remove(@PathVariable Long[] changeOrderIdHs)
    {
        return toAjax(flightOrderChangeHService.deleteFlightOrderChangeHByIds(changeOrderIdHs));
    }
}
